﻿
using Gaf;

using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

using System.Reflection;

namespace LiteGafDemo.LiteAddins
{
    public class WithAddinEventActivator
    {
        public string Name => MethodBase.GetCurrentMethod()!.DeclaringType!.Name.Replace("Activator", "");
        public int StartLevel => 5;

        public WithAddinEventActivator()
        {
            Gaf.GafManager.Current.AddinStateChanged += Current_AddinChanged;
        }

        private void Current_AddinChanged(IAddin addin)
        {
            Console.WriteLine("11111");
        }
        public void Configure(IConfiguration configuration, IServiceCollection services)
        {

        }

        /// <summary>
        /// 应用启动
        /// </summary>
        /// <param name="context"></param>
        public void Start(IServiceProvider provider)
        {
        }
    }

    public class WithAddinEvent2Activator
    {
        public string Name => MethodBase.GetCurrentMethod()!.DeclaringType!.Name.Replace("Activator", "");
        public int StartLevel => 5;


        public WithAddinEvent2Activator()
        {
            Gaf.GafManager.Current.AddinStateChanged += Current_AddinChanged;
        }

        private void Current_AddinChanged(IAddin addin)
        {
            Console.WriteLine("22222");
        }

        public void Configure(IConfiguration configuration, IServiceCollection services)
        {

        }

        /// <summary>
        /// 应用启动
        /// </summary>
        /// <param name="context"></param>
        public void Start(IServiceProvider provider)
        {
        }
    }
}
